<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of TruncatePost
 *
 * @author neozilon
 */
class Nosql_View_Helper_TruncatePost {

    public function truncatePost($content, $length = 300, $separator = '...'){
        $text = $content;
	$text = preg_replace('`\[[^\]]*\]`','',$text);
	$text = strip_tags($text);
	$text = substr($text, 0, $length);
	$text = substr($text, 0, strripos($text, " "));
	$text = $text.$separator;
	return $text;
    }

}